package org.nashua.tt151;

//Import when using parsing
import org.nashua.tt151.Parsers.ProtocolParsing.*;
import org.nashua.tt151.Parsers.*;

/**
 * A class showing how to use the ProtocolParsing class.
 * @author Brennan
 */
public class ParserExample {
    
    public static void main(String[] args) {
        
        String message = "R:CA:270:args,args,ARGS";
        
        Command c = Parser.getCommand(message);
        Key k = Parser.getKey(message);
        
        print(Character.toString(c.shorthand));
        print(k.shorthand);
        String[] pargs = Parser.getArgs(message);
        for (int i = 0; i != pargs.length; i++) {
            print(pargs[i]);
        }
        
        String msg = Parser.createMessage(Command.Send, Key.SolenoidValue, "1", new String[]{"Slot 1", "Module 2"} );
        print(msg);
        
        print(ValueParser.Convert(45.6142, ValueConstants.ANGLE_MIN, ValueConstants.ANGLE_MAX, 2));
        print(ValueParser.ParseDouble("32.465") + "");
        
       
    }
    
    private static void print(String msg) {
        System.out.println(msg);
    }
    
    
}
